package com.chen.recruit.controller;

import java.util.List;
import java.util.Arrays;

import com.chen.recruit.common.annotation.Log;
import com.chen.recruit.common.api.CommonResult;
import com.chen.recruit.common.enums.BusinessType;
import com.chen.recruit.common.valid.AddGroup;
import com.chen.recruit.common.valid.UpdateGroup;
import com.chen.recruit.domain.model.PageQuery;
import lombok.RequiredArgsConstructor;

import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.*;

import cn.dev33.satoken.annotation.SaCheckPermission;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import com.chen.recruit.domain.vo.RecruitPostVo;
import com.chen.recruit.service.RecruitPostService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@Api(tags = "招聘岗位管理 RecruitPostController")
@RequiredArgsConstructor
@RestController
@RequestMapping("/recruit/post")
public class RecruitPostController {

    private final RecruitPostService recruitPostService;

    @ApiOperation("新增招聘岗位")
    @SaCheckPermission("recruit:post:add")
    @Log(module = "招聘管理-招聘岗位", businessType = BusinessType.INSERT)
    @PostMapping
    public CommonResult add(@Validated(AddGroup.class) @RequestBody RecruitPostVo bo) {
        return null;
    }

    @ApiOperation("删除招聘岗位")
    @SaCheckPermission("recruit:post:delete")
    @Log(module = "招聘管理-招聘岗位", businessType = BusinessType.DELETE)
    @DeleteMapping("/{recruitPostIds}")
    public CommonResult delete(@NotEmpty(message = "主键不能为空") @PathVariable Integer[] recruitPostIds) {
        return null;
    }

    @ApiOperation("更新招聘岗位")
    @SaCheckPermission("recruit:post:update")
    @Log(module = "招聘管理-招聘岗位", businessType = BusinessType.UPDATE)
    @PutMapping
    public CommonResult update(@Validated(UpdateGroup.class) @RequestBody RecruitPostVo bo) {
        return null;
    }

    @ApiOperation("获取招聘岗位详细信息")
    @SaCheckPermission("recruit:post:get")
    @GetMapping("/{recruitPostId}")
    public CommonResult getInfo(@NotNull(message = "主键不能为空") @PathVariable("recruitPostId") Integer recruitPostId) {
        return null;
    }

    @ApiOperation("查询招聘岗位列表")
    @SaCheckPermission("recruit:post:list")
    @GetMapping("/list")
    public CommonResult list(RecruitPostVo bo, PageQuery pageQuery) {
        return null;
    }

    @ApiOperation("导出招聘岗位列表")
    @SaCheckPermission("recruit:post:export")
    @Log(module = "招聘管理-招聘岗位", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response) {
//        List<RecruitPostVo> list = recruitPostService.queryList(bo);
//        ExcelUtil.exportExcel(list, "招聘岗位", RecruitPostVo.class, response);
    }

}
